package com.jf.identity.controller;

import com.jf.identity.entity.DataProgress;
import com.jf.identity.entity.ResponseBean;
import com.jf.identity.service.DataProgressService;
import com.jf.identity.util.Params;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("vis")
@RestController
public class DataProgressController {
    @Resource
    private DataProgressService dataProgressService;

    @RequestMapping("set-identity-process-info")
    public ResponseBean setProcessInfo(@Validated @RequestBody DataProgress dataProgress,
                                       BindingResult bindingResult) {
        Params.beanValidate(bindingResult);
        Params.isAnyBlank(dataProgress, dataProgress.getExamPlan(),
                dataProgress.getOrgCode(), dataProgress.getTotal());
        return new ResponseBean(dataProgressService.insertDataProgress(dataProgress));
    }
}
